import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/hello")//配置路由
public class HelloServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //super.doGet(req, resp);

        //此时打印出的hello world是在服务器日志中产生的（tomcat）
        System.out.println("hello world");
        //要想把hello world返回给客户端，还需要进一步使用以下代码
        resp.getWriter().write("hello world");
    }
}
